/*O+KLGXbmptzs5MZY6CVshMPjGNwOD2DZd3vagz2mlOUdsrrNPToRiT1uPphTbffn*/
import {
	contractTransferSearch,
	contractTransferHead,
	contractTransferBody,
	contractTransferPageCode
} from '../constants';
import { ajax, toast } from 'nc-lightapp-front';
import ampub from 'ampub';
const { utils } = ampub;

const { showMessage, MsgConst, showConfirm } = utils.msgUtils;
const { getMultiLangByID } = utils.multiLangUtils;

export default function clickSerachBtn(isRefAddLine, billvo) {
	let searchVal = this.props.search.getAllSearchData(contractTransferSearch);
	if (searchVal) {
		let querydata = this.props.search.getQueryInfo(contractTransferSearch, true);
		if (querydata) {
			querydata.pagecode = contractTransferPageCode;
			querydata.billtype = '4A3A';
			querydata.userdefObj = {
				busiTypes: 'ISNOTBUSITYPE',
				headCode: 'head',
				bodyCode: 'bodyvos'
			};
		}
		ajax({
			url: '/nccloud/fa/assettransfer/contract.do',
			data: querydata,
			success: (res) => {
				let { success, data } = res;
				if (success) {
					if (data) {
						this.props.transferTable.setTransferTableValue(
							contractTransferHead,
							contractTransferBody,
							data,
							'pk_contract',
							'pk_contract_eq'
						);
					} else {
						this.props.transferTable.setTransferTableValue(
							contractTransferHead,
							contractTransferBody,
							null,
							'pk_contract',
							'pk_contract_eq'
						);
						showMessage(this.props, { color: 'warning', content: getMultiLangByID('201201512A-000037') });
					}
				}
			}
		});
	}
}

/*O+KLGXbmptzs5MZY6CVshMPjGNwOD2DZd3vagz2mlOUdsrrNPToRiT1uPphTbffn*/